feat(Branches): 新增「清理已删远程分支」入口,解决 LOG 视图残留已删分支提交问题 - #44
Merged
ThreeFish-AI merged 2 commits intoJul 1, 2026
Conversation
- 新增 hyperGit.pruneRemotes 命令(Branches 视图工具栏,icon=clear-all): 执行 git fetch --prune 清理陈旧 refs/remotes/* 跟踪引用,使 LOG 的 All 范围 不再经其触达已删远程分支的提交(根因:分支在远端删除后本地跟踪引用未 prune) - prune 前后对 refs/remotes 各快照一次,以 diffPrunedRefs 差集给出循证反馈, 规避 [deleted] 明细走 stderr 而 execGit 仅回传 stdout 的解析限制 - 修复 hyperGit.fetch / hyperGit.deleteRemoteBranch 仅刷新 branchesTree、 遗漏 logTree.refresh() 导致 LOG 不能即时反映引用变更的缺陷 - 补 diffPrunedRefs 纯函数单元测试(ref-cleanup) 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
pnpm/action-setup@v6(135f509 由 v4 升级引入)为破坏性变更:严格要求解析 pnpm 版本, 不再隐式回退 latest。原步骤序 action-setup 先于 checkout,致 package.json 未就绪、 无法读取 packageManager 字段,CI 在 setup 阶段即报 "No pnpm version is specified"。 将 actions/checkout 前置于 pnpm/action-setup,使其从检出的 package.json 读取 packageManager: pnpm@11.9.0(单一事实源,无需在 workflow 重复声明 version)。 lint-build / test / package / publish 四个 job 同步修正。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This was referenced Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
LOG 视图的
All范围通过git log --all拉取提交,--all会遍历refs/heads/*+refs/remotes/*+refs/tags/*。当一个分支在远端被删除(如 GitHub PR 合并后删分支、队友删分支),但本地的远程跟踪引用refs/remotes/origin/<branch>未被 prune 时,--all仍能经该陈旧引用遍历到那些提交——导致「已删除分支」的提交继续残留在 LOG 视图中。git fetch默认不清理已消失的远程跟踪引用,需要显式--prune。方案(复用驱动 + 最小干预)
hyperGit.pruneRemotes命令(Branches 视图工具栏,clear-all图标):执行git fetch --prune清理陈旧refs/remotes/*,使 LOG 的All范围反映真实远程状态。复用既有repo.fetch({ prune: true })能力。refs/remotes各快照一次,以diffPrunedRefs差集得出被清理的引用名并提示用户。规避[deleted]明细走 stderr 而execGit仅回传 stdout 的解析限制。hyperGit.fetch与hyperGit.deleteRemoteBranch在改动引用后只刷新了branchesTree,遗漏logTree.refresh()(logTree已在作用域内),导致 LOG 不能即时反映引用变更。补齐后 prune / fetch / 删除远程分支均即时刷新 LOG。改动文件
src/engine/ref/cleanup.tsdiffPrunedRefs(before, after)(零 vscode 依赖,便于单测)src/adapter/history-commands.tspruneRemotes命令 +listRemoteTrackingRefs辅助;fetch补logTree.refresh()src/adapter/remote-commands.tsdeleteRemoteBranch补logTree.refresh()package.json1_sync@1.5,紧邻 Fetch)tests/unit/ref-cleanup.test.tsdiffPrunedRefs单元测试(5 例)验证
pnpm run check-types(tsc):通过pnpm run lint(ESLint,CI 门禁):通过node esbuild.js(打包):通过pnpm run test:unit(vitest):306 / 306 全部通过(含新增 5 例)非目标
git log --all构造;🤖 Generated with Claude Code